package com.example.helloworld;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;

import com.example.helloworld.widget.TitleBitmapButton;
import com.example.helloworld.widget.TitleButton;

public class BitmapWidget extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		setContentView(R.layout.activity_bitmap_widget);
		
		TitleBitmapButton arrowLeftButton =	(TitleBitmapButton)findViewById(R.id.arrowLeftButton);
		
		Resources resources =		getResources();
		BitmapDrawable drawable =	(BitmapDrawable)resources.getDrawable(R.drawable.arrow_left);
		Bitmap bitmap =				drawable.getBitmap(); 
		BitmapDrawable drawableClick =
									(BitmapDrawable)resources.getDrawable(R.drawable.arrow_left_clicked);
		Bitmap bitmapClick =		drawableClick.getBitmap();
		arrowLeftButton.setIconBitmap(bitmap, bitmapClick);
		arrowLeftButton.setOnClickListener(new OnClickListener() {
			public void onClick(View view) {
				finish();
			}
		});
		
		String titleText =	"Bitmap Title";
		
		TitleButton titleButton =	(TitleButton)findViewById(R.id.titleButton);
		titleButton.setTitleText(titleText);
		titleButton.setDefaultSize(18F);
	}

}
